//
//  WPDiseaseInstructionHeaderView.m
//  wobingwoyi
//
//  Created by WGP on 2016/12/1.
//  Copyright © 2016年 WGP. All rights reserved.
//

#import "WPDiseaseInstructionHeaderView.h"

@implementation WPDiseaseInstructionHeaderView

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
        
        self.contentView.backgroundColor = GlobalBgColor;
        
        self.iconView = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.contentView addSubview:self.iconView];
        [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(10);
            make.top.equalTo(self).offset(12.5);
        }];
        
        self.label = [UILabel new];
        self.label.textColor = GLobalFontColor;
        self.label.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:self.label];
        [self.label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.iconView);
            make.left.equalTo(self.iconView.mas_right).offset(10);
        }];
        
        self.arrowView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"disease_arrow_normal"]];
        [self.contentView addSubview:self.arrowView];
        [self.arrowView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.iconView);
            make.right.equalTo(self.contentView).offset(-10);
        }];
        
        UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
        btn.backgroundColor = [UIColor clearColor];
        [self.contentView addSubview:btn];
        [btn addTarget:self action:@selector(coverBtnDidClick) forControlEvents:UIControlEventTouchDown];
        [btn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self.contentView);
        }];
        
        UIImageView *bottomLine = [UIImageView lineImageView];
        //        bottomLine.backgroundColor = [UIColor orangeColor];
        [self.contentView addSubview:bottomLine];
        self.bottomLine = bottomLine;
        [bottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.equalTo(self);
            make.height.mas_equalTo(0.5);
        }];
        
//        UIImageView *topLine = [UIImageView lineImageView];
//        //        bottomLine.backgroundColor = [UIColor orangeColor];
//        [self.contentView addSubview:topLine];
//        [topLine mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.left.right.top.equalTo(self);
//            make.height.mas_equalTo(0.5);
//        }];
        
    }
    return self;
}

-(void)coverBtnDidClick
{
    if ([self.delegate respondsToSelector:@selector(WPDiseaseInstructionViewCoverBtnDidClick:)])
    {
        [self.delegate WPDiseaseInstructionViewCoverBtnDidClick:self];
    }
}

@end
